Anonymous (co)inductive types: A way for structured recursion to cohabit with modular abstraction
نویسنده
چکیده
We investigate the interaction between structured recursion combinators and modularization in the style of Standard ML. When built-in structured recursion combinators are straightforwardly added to a language like SML’97 or OCaml, they cannot operate over values of abstractly specified types. Consequently, when a program is modularized in an abstract and fine-grained way, the structured recursion combinators can hardly ever be used. We explore various ways of solving this incompatibility, presenting the possible solutions in our modular programming language with a verbose notation for inductive and coinductive types and operations. We propose structured recursion programming constructs that are, in our opinion, best suited for action across abstract module boundaries: anonymous inductive and coinductive types separated from sum and product types, and the related operations. We discuss advantages and disadvantages of the proposed programming idioms and their expressibility in other languages and formal systems, such as OCaml, Charity, Functorial ML and PolyP. We describe their precise typing and semantics as parts of our programming language. Finally we discuss other possible uses of the introduced constructs, related to both polytypism and modular programming and inspired by the notions of views and 2-level types.
منابع مشابه
CoInduction in Coq
When providing a collection of constructors to define an inductive type, we actually also define a dual operation: a destructor. This destructor is always defined using the same structure of pattern-matching, so that we have a tendency to forget that we do extend the “pattern-matching” capability with a new destructor at each definition. Constructors and destructors play a dual role in the defi...
متن کاملMonotone ( Co ) Inductive Types and Fixed - Point Types
We study ve extensions of the polymorphically typed lambda-calculus (system F) by type constructs intended to model xed-points of monotone operators. Building on work by H. Geuvers concerning the relation between term rewrite systems for least pre-xed-points and greatest post-xed-points of positive type schemes (i. e., non-nested positive inductive and coinductive types) and so-called retract t...
متن کاملHaskell Programming with Nested Types: A Principled Approach
Initial algebra semantics is one of the cornerstones of the theory of modern functional programming languages. For each inductive data type, it provides a Church encoding for that type, a build combinator which constructs data of that type, a fold combinator which encapsulates structured recursion over data of that type, and a fold/build rule which optimises modular programs by eliminating from...
متن کاملHaskell Programming with Nested Types : A Principled
Initial algebra semantics is one of the cornerstones of the theory of modern functional programming languages. For each inductive data type, it provides a Church encoding for that type, a build combinator which constructs data of that type, a fold combinator which encapsulates structured recursion over data of that type, and a fold/build rule which optimises modular programs by eliminating from...
متن کاملApplication of Category-Theory Methods to the Design of a System of Modules for a Functional Programming Language
Module systems embed elements of methodologies, formalisms and tools for programming-in-the-large into programming languages. In our thesis we design a module system, its categorical model and a constructive semantics of the system in the model. The categorical model is simple and general, built using elementary categorical notions, admitting many variants and extensions of the module system. O...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2006